package com.wanmait.gohome.controller.manage;

import com.github.pagehelper.PageInfo;
import com.wanmait.gohome.pojo.Comment;
import com.wanmait.gohome.service.CommentService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@RequestMapping("/manage")
@Controller
public class RemarkController {

    @Resource
    CommentService commentService;
    @RequestMapping("/comment/commentShow")
    public void commentShow()
    {

    }
    //查询内容分页
    @RequestMapping("/comment/findcomment")
    public ModelAndView findcomment()
    {
        ModelAndView mv = new ModelAndView();
        PageInfo<Comment> pageInfo = commentService.findPage();
        mv.addObject("pageInfo",pageInfo);
        return mv;
    }
    //封停
    @RequestMapping("/comment/closure1")
    @ResponseBody
    public void closure1(Comment comment)
    {
        commentService.updateEnable(comment);
    }
    @RequestMapping("/comment/findSealComment")
    public ModelAndView findSealComment()
    {
        ModelAndView mv = new ModelAndView();
        PageInfo<Comment> pageInfo = commentService.findSealComment();
        mv.addObject("pageInfo",pageInfo);
        return mv;
    }
    //删除
    @RequestMapping("/comment/omit")
    @ResponseBody
    public void omit(Comment comment)
    {
        commentService.delete(comment.getId());
    }

}
